#ifndef __CSP_WDT_H__
#define __CSP_WDT_H__
//#include "AC33Mx128.h"


typedef struct {

	CSP_REGISTER_T		WDTLR; 				// addr = 0x4000_0200, WO
	CSP_REGISTER_T		WDTCNT;				// addr = 0x4000_0204, RO 
	CSP_REGISTER_T		WDTCON; 			// addr = 0x4000_0208, RW 


} CSP_WDT_T;



//==========================================================================
// 	WDTLR
//		
//				@ address = 0x4000_0200
//
//==========================================================================




//==========================================================================
// 	WDTCNT
//		
//				@ address = 0x4000_0204
//
//==========================================================================




//==========================================================================
// 	WDTCON
//		
//				@ address = 0x4000_0208
//
//==========================================================================
#define WDTCON_WDBG							(0x0001<<15)

#define WDTCON_WUF							(0x0001<<8)
#define WDTCON_WDTIE						(0x0001<<7)

#define WDTCON_WDTRE						(0x0001<<6)
#define WDTCON_WDTEN						(0x0001<<4)


#define WDTCON_CKSEL						(0x0001<<3)
#define WDTCON_CKSEL_PCLK					(0x0000<<3)
#define WDTCON_CKSEL_RINGOSC				(0x0001<<3)


#define WDTCON_WPRS_WDTCLKIN				(0x0000<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_4		(0x0001<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_8		(0x0002<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_16		(0x0003<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_32		(0x0004<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_64		(0x0005<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_128		(0x0006<<0)
#define WDTCON_WPRS_WDTCLKIN_DIV_BY_256		(0x0007<<0)




//==========================================================================
// 
//		M A C R O S
//
//==========================================================================
#define CSP_WDT_GET_WDTLR(wdt)					((wdt)->WDTLR)
#define CSP_WDT_SET_WDTLR(wdt, val)				((wdt)->WDTLR = (val))
//-----------------------------------------------------------------------------------------
#define CSP_WDT_GET_WDTCNT(wdt)					((wdt)->WDTCNT)
//-----------------------------------------------------------------------------------------
#define CSP_WDT_GET_WDTCON(wdt)					((wdt)->WDTCON)
#define CSP_WDT_SET_WDTCON(wdt, val)			((wdt)->WDTCON = (val))
//-----------------------------------------------------------------------------------------



// WDT
extern CSP_WDT_T			* const			WDT; 


//==========================================================================
// 
//		F U N C T I O N    D E C L A R A T I O N S 
//
//==========================================================================


#endif 

